<template>
    <div>
        <n-breadcrumb separator=">">
            <n-breadcrumb-item v-for="index in breadcrumbList" @click="clickBreadcrumb(index)">
                {{ index }}
            </n-breadcrumb-item>
        </n-breadcrumb>
        <!--        全部成绩-->
        <all-grade
            :add-breadcrumb-list="addBreadcrumbList"
            :set-class="setClass"
            v-if="breadcrumbList.length===1"
        />
        <!--        班级成绩-->
        <class-grade
            :add-breadcrumb-list="addBreadcrumbList"
            :training_id="training_id"
            :class_id="class_id"
            :set-student="setStudentId"
            v-if="breadcrumbList.length===2"
        />
<!--        个人成绩-->
        <personal-grade
            :add-breadcrumb-list="addBreadcrumbList"
            :training_id="training_id"
            :class_id="class_id"
            :student_id="student_id"
            v-if="breadcrumbList.length===3"
        />
    </div>
</template>

<script setup>

import AllGrade from "@/components/teacher/成绩管理/AllGrade.vue";
import ClassGrade from "@/components/teacher/成绩管理/ClassGrade.vue";
import PersonalGrade from "@/components/teacher/成绩管理/PersonalGrade.vue";

const breadcrumbList = ref(["成绩管理"])
/**
 * 添加面包屑的内容
 * @param route 添加到最后的内容
 */
const addBreadcrumbList = (route) => {
    breadcrumbList.value.push(route)
}
/**
 * 点击面包屑
 * @param breadcrumbName 点击的内容
 */
const clickBreadcrumb = (breadcrumbName) => {
    switch (breadcrumbName) {
        case "成绩管理":
            breadcrumbList.value = ["成绩管理"]
            break;
        case "班级成绩":
            breadcrumbList.value = ["成绩管理","班级成绩"]
            break;
        case "个人成绩":
            break;

    }
}

// 查询的班级信息
let training_id = ""
let class_id = ""
const setClass = (trainingId = null, classId = null) => {
    console.log(trainingId, classId)
    training_id = trainingId
    class_id = classId
}

// 查询个人成绩
let student_id = ''
const setStudentId = (StudentId) => student_id = StudentId

</script>

<style scoped lang="less">

</style>